[Programming Problem] Paint Fence

You are painting a fence of n posts with k different colors. You must paint the posts following these rules: Every post must be painted exactly one color. At most one pair of adjacent fence posts can have the same color. Given the two integers n and k, return the number of ways you can … Continue reading [Programming Problem] Paint Fence